﻿/********************************************************************
	file base:	DalLib
	file ext:	cs
	author:		mcvrlab
	
	purpose:	 公共函数库
*********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace COMM
{
   public class DalLib
    {
       /// <summary>
       /// 构造查询字段列表
       /// </summary>
       /// <param name="refiles"></param>
       /// <returns></returns>
       public static string BuildRStr(Dictionary<string,string> refiles) {

        
           StringBuilder str_refiles = new StringBuilder();
           string str_refile = string.Empty;

           StringBuilder str_filters = new StringBuilder();

           foreach (string s in refiles.Keys)
           {

               str_refiles.Append(refiles[s]);
               str_refiles.Append(",");
           }
           str_refile = str_refiles.ToString();
           str_refile = str_refile.Substring(0, (str_refile.Length - 1));


           return str_refile;

       }
       /// <summary>
       /// 构造查询条件列表
       /// </summary>
       /// <param name="fiters"></param>
       /// <returns></returns>
       public static string BuildFStr(Dictionary<string,string> fiters) {


    

           string str_filter = string.Empty;
           StringBuilder str_filters = new StringBuilder();
           foreach (string s in fiters.Keys)
           {

               str_filters.Append(" and ");
               str_filters.Append(fiters[s]);
           }
           str_filter = str_filters.ToString();



           return str_filter;
       }
    }
}
